package com.eastday.util;

import java.io.IOException;

import org.jdom.JDOMException;

/**
 * 
 * @author dingxs
 *
 */
public class BeanFactory {

	public static Object getBean(String className)
	{
		ExceptionHandler exceptionHandler = new ExceptionHandler();
		try {
			String classPath = ParseConfigFactory.getBeanPath(className);
			Class clazz = Class.forName(classPath);
			Object daobean = clazz.newInstance();
			return daobean;
		} catch (SecurityException e) {
			// TODO Auto-generated catch block
			exceptionHandler.writeToLog(e.getMessage());
		} catch (IllegalArgumentException e) {
			// TODO Auto-generated catch block
			exceptionHandler.writeToLog(e.getMessage());
		} catch (JDOMException e) {
			// TODO Auto-generated catch block
			exceptionHandler.writeToLog(e.getMessage());
		} catch (IOException e) {
			// TODO Auto-generated catch block
			exceptionHandler.writeToLog(e.getMessage());
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			exceptionHandler.writeToLog(e.getMessage());
		} catch (InstantiationException e) {
			// TODO Auto-generated catch block
			exceptionHandler.writeToLog(e.getMessage());
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			exceptionHandler.writeToLog(e.getMessage());
		} 
		return null;
	}
}
